<template>
  <div class="report-con">
    <!-- <div class="tips">销售报表每天早上6点和下午6点更新数据！！！</div> -->
    <iframe class="iframe-ele" v-if="reportUrl" :src="reportUrl"></iframe>
    <div class="nodata" v-if="!reportUrl">报表不存在</div>
  </div>
</template>
<script>
export default {
  props: {
    reportKey: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      reportMap: {
        '/report/CustomerOrderList': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_order_list.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerOrderDetail': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_order_detail.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerOrderHistoryList': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_order_history_list.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerOrderHistoryDet': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_order_history_detail.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/ProductStock': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_product_stock.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/LogisticsOrder': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_logistics_bill.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerAccountList': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_customer_history_list.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerBalanceList': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_account_balance_list.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerDiscountList': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_discount_record.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerStatementList': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_statement_list.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/PlatformDiscounts': 'https://oms.flyco.net.cn//webroot/decision/view/report?viewlet=jx_report%252FJX_JXC_PlatormDiscount.cpt&ref_t=design&ref_c=5f10dcc2-8de5-4085-a2d2-c661d05b330c?id=62',
        '/report/AmountDifference': 'https://oms.flyco.net.cn//webroot/decision/view/report?viewlet=jx_report%252FJX_JXC_Orderdifference.cpt&ref_t=design&ref_c=5f10dcc2-8de5-4085-a2d2-c661d05b330c?id=64',
        '/report/ShoppingCart': 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_shopping_cart.cptx&uid=${uid}&partnerid=${partnerid}',
        '/report/CustomerOrderSumList': "https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_order_sum.cptx&uid=${uid}&partnerid=${partnerid}",
        "/report/UserCustomerList": "https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco-b2b%252Fb2b_user_store_list.cptx&uid=${uid}&partnerid=${partnerid}",
        "/report/LogisticsWaybillList": "https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco%252Foms%252Flogistics_waybill.cpt&uid=${uid}&partnerid=${partnerid}",
        "/report/LogisticsWaybillDetail": "https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco%252Foms%252Flogistics_waybilldetail.cpt&uid=${uid}&partnerid=${partnerid}"
      }
      // reportUrl: 'https://oms.flyco.net.cn//webroot/decision/view/report?viewlet=jx_report%252FJX_JXC_Orderdifference.cpt&ref_t=design&ref_c=5f10dcc2-8de5-4085-a2d2-c661d05b330c?id=64'
    }
  },
  computed: {
    reportUrl() {
      console.log('this.reportKey', this.reportKey)
      const url = this.reportMap[this.reportKey]
      if (url) {
        const user = this.$store.getters.userInfo
        return url.replace('${uid}', user.id).replace('${partnerid}', user.partnerId)
      } else {
        return ''
      }
    }
  },
  created() {
  }
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';

.report-con {
  // min-height: 100vh;
  height: calc(100vh - 210px);

  .tips {
    color: #d7771d;
    font-size: 13px;
    line-height: 20px;
    margin-top: -10px;
    margin-bottom: 15px;
  }

  .iframe-ele {
    height: 100%;
    width: 100%;
    border: none;
  }
}
</style>